void InitExpTree(BTree &T,string str){
	stack<char> op;
	stack<BTree>root;
	BTree bt,leaf;
	int i=0;
	op.push('#');
	while(str[i]){
		if(str[i]>='0'&&str[i]<='9') {
			leaf=new BTNode;
			leaf->data=str[i];
			leaf->lchild=leaf->rchild=NULL; 
			root.push(leaf);
		}
		else if (In(str[i])){
			while(Precede(op.top(),str[i])=='>'){
				bt=new BTNode;
				bt->data=op.top();
				op.pop();
				leaf=root.top();
				root.pop();
				bt->rchild=leaf;
				leaf=root.top();
				root.pop();
				bt->lchild=leaf;
				root.push(bt);
			}
			if(Precede(op.top(),str[i])=='<'){
				op.push(str[i]);
			}
			else {
				op.pop();
			}
		}
		i++;
	}
	while(op.top()!='#'){
		bt=new BTNode;
		bt->data=op.top();
		op.pop();
		leaf=root.top();
		root.pop();
		bt->rchild=leaf;
		leaf=root.top();
		root.pop();
		bt->lchild=leaf;
		root.push(bt);
	}
	T=root.top(); 
}
double EvaluateExTree(BTree T){
	stack<BTree>s;
	stack<double>s1;
	double a,b,result=0; 
	BTree p;
	int flag=-1;
	do{
		while(T!=NULL){
			s.push(T);
			T=T->lchild;
		}
		p=NULL;
		flag=1;
		while(!s.empty()&&flag){
			T=s.top();
			if(T->rchild==p){
				if(T->data>='0'&&T->data<='9'){
					s1.push(T->data-'0');
				}
				else {
					a=s1.top();
					s1.pop();
					b=s1.top();
					s1.pop();
					switch(T->data){
						case '+':
							result=a+b;
							break;
						case '-':
							result=b-a;
							break;
						case '/':
							if(a==0) {
								cout<<"divide 0 error!";
								exit(0);
							}
							result=b/a;
							break;
						case '*':
							result=a*b;
							break;
					}
					s1.push(result);
				}
				p=T;
				s.pop();
			}
			else {
				T=T->rchild;
				flag=0;
			}
		}
	}while(!s.empty());
	return s1.top();
}
